package cn.rongdao.jrkabao.model.takephoto;

import com.mifengkong.frtools.http.request.HttpFunction;
import com.mifengkong.frtools.util.FRString;

import cn.rongdao.jrkabao.model.api.BaseKaMaoModel;
import io.reactivex.Observable;
import io.reactivex.Observer;

/**
 * Created by jack on 2018/1/4
 */

public class UploadAvatarModel extends BaseKaMaoModel {

    public static UploadAvatarModel getInstance() {
        return getPresent(UploadAvatarModel.class);
    }

    public void execute(String base64Data, String suffix, Observer<String> observer) {
        addParamStrings("img", FRString.valueOf(base64Data));
        addParamStrings("suffix", FRString.isEmpty(suffix) ? ".jpg" : suffix);
        Observable<String> observable = mServletApi.uploadUserLogo(mParams).map(new HttpFunction<String>());
        toSubscribe(observable, observer);
    }
}